function sum() {
    return new Promise(resolve => {
      let sum = 0;
      // 这里其实也是同步函数, 也是从上到下的执行.
      for (let i = 0; i < 10000; i++) {
        sum += i
      }
      resolve(sum)
    })
  }

  async function ck() {
    const res = await sum()
    console.log(res);
  }
  ck()

  async function ck1() {
    const res = await  Promise.resolve().then(_ => {
      let count = 0
      for (let i = 0; i < 1000; i++) {
        count += i
      }
      return count
    })
    console.log(res);
  }
  ck1()
  console.log('ck');